//
//  ViewController.swift
//  corner_shadow
//
//  Created by 李煜 on 2024/5/13.
//


import UIKit

class ViewController: UIViewController {
    let customView: Method3View = Method3View(frame: CGRect(x: 20, y: 100, width: 200, height: 200))
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(customView)
        //没加masksToBounds也可以同时阴影和圆角啊 疑惑
//                customView.layer.masksToBounds = true
        customView.backgroundColor = .systemBlue
        customView.layer.cornerRadius = 38
        
        customView.layer.shadowColor = UIColor.black.cgColor
        customView.layer.shadowOffset = CGSize(width: 3, height: 3)
        customView.layer.shadowOpacity = 0.5
        customView.layer.shadowRadius = 3
        customView.layer.shadowPath = UIBezierPath(roundedRect: customView.bounds, cornerRadius: customView.layer.cornerRadius).cgPath
    }
}

#Preview(traits: .portrait, body: {
    ViewController()
})
